Port ComplexWatsonDistribution from libDirectional MATLAB to Python#1650
Port ComplexWatsonDistribution from libDirectional MATLAB to Python#1650
Conversation
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/74477cd7-c6d6-4f3c-b665-743dd780b08f Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/74477cd7-c6d6-4f3c-b665-743dd780b08f Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining
|
Test Results0 tests 0 ✅ 0s ⏱️ Results for commit 653013a. ♻️ This comment has been updated with latest results. |
|
@copilot Suppress the the linter warnings: ************* Module pyrecest.distributions.hypersphere_subset.complex_watson_distribution |
Agent-Logs-Url: https://github.com/FlorianPfaff/PyRecEst/sessions/c2bd72bd-a527-4bdb-a5a8-1af8f58bc43b Co-authored-by: FlorianPfaff <6773539+FlorianPfaff@users.noreply.github.com>

Summary
Ports the
ComplexWatsonDistributionfrom MATLAB/libDirectional to Python.Reference
Changes
New file:
pyrecest/distributions/hypersphere_subset/complex_watson_distribution.pyImplements
ComplexWatsonDistribution– a distribution over the complex unit sphere C^D with pdf:Methods:
__init__(mu, kappa)– takes complex unit vectormu(shape(D,)) and scalarkappamean()– returnsmupdf(za)– evaluates density at rows of complex arrayza(shape(N, D))sample(n)– samplesnpoints on the complex unit sphere using the complex Bingham sampling algorithm (Mardia & Jupp 2009, p. 336)log_norm(D, kappa)– static; log normalization constant using three numerical regimes (low/medium/high κ) for stability across the full κ rangefit(Z, weights=None)– classmethod; MLE fitestimate_parameters(Z, weights=None)– static; Mardia & Dryden MLE (scatter matrix eigendecomposition + hypergeometric ratio inversion)_hypergeometric_ratio_inverse(rho, D, kappa_max)– static; solves1F1(2;D+1;κ) / (D · 1F1(1;D;κ)) = ρusing mpmath + scipy.optimize.brentqUpdated:
pyrecets/distributions/__init__.pyComplexWatsonDistributionNew file:
pyrecest/tests/distributions/test_complex_watson_distribution.py20 unit tests covering: construction,
mean(),log_norm(),pdf()(symmetry/phase-invariance/positivity),sample()(shape/unit-norm), andestimate_parameters()/fit().Notes